/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.OneCommerceProject.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Aymen
 */
@Entity
@Table(name = "COMMANDEFOUR", catalog = "", schema = "AYMEN")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Commandefour.findAll", query = "SELECT c FROM Commandefour c"),
    @NamedQuery(name = "Commandefour.findByIdcomfour", query = "SELECT c FROM Commandefour c WHERE c.idcomfour = :idcomfour"),
    @NamedQuery(name = "Commandefour.findByDatecomfour", query = "SELECT c FROM Commandefour c WHERE c.datecomfour = :datecomfour")})
public class Commandefour implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDCOMFOUR", nullable = false, precision = 22, scale = 0)
    @GeneratedValue(strategy= GenerationType.AUTO)
    private BigDecimal idcomfour;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DATECOMFOUR", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date datecomfour;
    @JoinColumn(name = "IDITEM", referencedColumnName = "IDITEM", nullable = false)
    @ManyToOne(optional = false)
    private Item iditem;
    @JoinColumn(name = "IDFOUR", referencedColumnName = "IDFOUR", nullable = false)
    @ManyToOne(optional = false)
    private Fournisseur idfour;

    public Commandefour() {
    }

    public Commandefour(BigDecimal idcomfour) {
        this.idcomfour = idcomfour;
    }

    public Commandefour(BigDecimal idcomfour, Date datecomfour) {
        this.idcomfour = idcomfour;
        this.datecomfour = datecomfour;
    }

    public BigDecimal getIdcomfour() {
        return idcomfour;
    }

    public void setIdcomfour(BigDecimal idcomfour) {
        this.idcomfour = idcomfour;
    }

    public Date getDatecomfour() {
        return datecomfour;
    }

    public void setDatecomfour(Date datecomfour) {
        this.datecomfour = datecomfour;
    }

    public Item getIditem() {
        return iditem;
    }

    public void setIditem(Item iditem) {
        this.iditem = iditem;
    }

    public Fournisseur getIdfour() {
        return idfour;
    }

    public void setIdfour(Fournisseur idfour) {
        this.idfour = idfour;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcomfour != null ? idcomfour.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Commandefour)) {
            return false;
        }
        Commandefour other = (Commandefour) object;
        if ((this.idcomfour == null && other.idcomfour != null) || (this.idcomfour != null && !this.idcomfour.equals(other.idcomfour))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.OneCommerceProject.entities.Commandefour[ idcomfour=" + idcomfour + " ]";
    }
    
}
